/**
 * @param {string} digits
 * @return {string[]}
 */
 var letterCombinations = function(digits) {
    let res=[]
    if(digits.length==0) return res
    let map = new Map([
        ['2',['a','b','c']],
        ['3',['d','e','f']],
        ['4',['g','h','i']],
        ['5',['j','k','l']],
        ['6',['m','n','o']],
        ['7',['p','q','r','s']],
        ['8',['t','u','v']],
        ['9',['w','x','y','z']]
    ])
    const tools = (str,starIndex)=>{
        if(str.length==digits.length){
            res.push(str)
            return 
        }
        let n =map.get(digits[starIndex])
        for(let i=0;i<n.length;i++){
            let str1=str
            str=str+n[i]
            tools(str,starIndex+1)
            str=str1
        }
    }
    tools('',0)
    return res
};
console.log(letterCombinations("234"));